package com.usian.jyzx.product.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.usian.jyzx.model.dto.product.ProductSkuDto;
import com.usian.jyzx.model.entity.product.ProductSku;
import com.usian.jyzx.product.mapper.ProductSkuMapper;
import com.usian.jyzx.product.service.ProductSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 07 04 15 02
 **/

@Service
public class ProductSkuServiceImpl implements ProductSkuService {

    @Autowired
    ProductSkuMapper productSkuMapper;
    @Override
    public List<ProductSku> findSaleSkuList() {
        return productSkuMapper.findSaleSkuList();
    }

    @Override
    public PageInfo<ProductSku> productList(Integer pageNo, Integer pageSize, ProductSkuDto productSkuDto) {
        PageHelper.startPage(pageNo, pageSize);
        List<ProductSku> productSkus = productSkuMapper.productList(productSkuDto);
        PageInfo<ProductSku> productSkuPageInfo = new PageInfo<>(productSkus);


        return productSkuPageInfo;
    }

    @Override
    public ProductSku findProductSkuById(Long id) {
        return productSkuMapper.findProductSkuById(id);
    }

    @Override
    public List<ProductSku> findProductByProductId(Long productId) {
        return productSkuMapper.findProductByProductId(productId);
    }


}
